import 'package:fish_redux/fish_redux.dart';

import 'action.dart';
import 'state.dart';

Reducer<FixResultViewState> buildReducer() {
  return asReducer(
    <Object, Reducer<FixResultViewState>>{
      FixResultViewAction.action: _onAction,
      FixResultViewAction.onTapStatus: _onTapStatus,
    },
  );
}

FixResultViewState _onAction(FixResultViewState state, Action action) {
  final FixResultViewState newState = state.clone();
  return newState;
}

FixResultViewState _onTapStatus(FixResultViewState state, Action action) {
  final FixResultViewState newState = state.clone()
    ..model.isSolve = action.payload;
  return newState;
}
